
#ifndef CONFIG_H
#define CONFIG_H

//{{{ file documentation -------------------------------------------------------

/*!
 * @file     config.h
 * @brief    dicodor configuration class declaration
 */

//}}} --------------------------------------------------------------------------
//{{{ includes / predeclarations -----------------------------------------------

// @(#) $Id:$

#include <QtCore/QSettings>
#include <QtCore/QDir>
#include <QtCore/QDebug>

#include <QtGui/QApplication>
#include <QtGui/QIcon>
#include <QtGui/QFont>
#include <QtGui/QTextDocumentWriter>



//}}} --------------------------------------------------------------------------
//{{{ structures ---------------------------------------------------------------
//}}} --------------------------------------------------------------------------
//{{{ .Config ------------------------------------------------------------------

//{{{ class documentation ------------------------------------------------------

/*!
 * @class    Config
 * @brief    dicodor configuration class
 *
 *           defines all what is necessary to the application\n
 *           pathes, icon, settings ...
 */

//}}} --------------------------------------------------------------------------


class Config :				public QSettings
{
	Q_OBJECT

public:
	explicit				Config (QObject * parent = 0);

public:
	static const QString	appName ();
	static const QString	appVersion ();
	static const QString	dicVersion ();

	static const QString	appIconPath ();
	static const QString	appHomePath ();
	static const QString	appWorkPath ();
	static const QString	appExportPath ();
	static const QIcon		appIcon ();
	static bool				isOdfFormatSupported ();
	static QStringList		supportedDocumentFormats ();

public:
	QFont					optionDefaultFont ()	const;
	QColor					optionUnderlineColor ()	const;
	QByteArray				optionSaveFormat ()		const;

public slots:
	void					setOptionDefaultFont (const QFont & font);
	void					setOptionUnderlineColor (const QColor & color);
	void					setOptionSaveFormat (const QString & format);
};

//}}} --------------------------------------------------------------------------
//{{{ inline / template functions ----------------------------------------------

//{{{ function documentation --------------------------------------------------

/*
 * @fn       Config::appName()
 * @brief    application for display in "a propos" dialog
 *
 *           some more details
 */

//}}} --------------------------------------------------------------------------

inline const QString Config::appName ()			{ return "dicodor";  }
inline const QString Config::appVersion ()		{ return "1.1"; }

inline const QString Config::appIconPath ()		{ return ":/images/appIcon.svg"; }
inline const QString Config::appHomePath ()		{ return QString ("%1/.%2/").arg (QDir::homePath ()).arg (appName()); }
inline const QString Config::appWorkPath ()		{ return QString ("%1/%2/").arg (QDir::tempPath ()).arg (appName()); }
inline const QString Config::appExportPath ()	{ return appHomePath () + "export/"; }

inline const QIcon   Config::appIcon ()			{ return QIcon (appIconPath()); }

inline bool Config::isOdfFormatSupported ()
{
	QList<QByteArray> formats (QTextDocumentWriter::supportedDocumentFormats ()) ;
	return formats.contains (QByteArray ("ODF"));
}

inline QStringList Config::supportedDocumentFormats ()
{
	QList<QByteArray> baFormats (QTextDocumentWriter::supportedDocumentFormats ()) ;
	QStringList result;

	foreach (const QByteArray& fmt, baFormats) {
		result << QString (fmt);
	}

	return result;
}



//}}} --------------------------------------------------------------------------

#endif // CONFIG_H

